import { router } from "./index"
import detailOne from '@/views/About/detail1.vue'
import detailTwo from '@/views/About/detail2.vue'

export default () => {
  let addAboutSub = false
  router.beforeEach((to, from) => {
    if (!addAboutSub && to.fullPath.startsWith('/about')) {
      console.log(123)
      addAboutSub = true

      router.addRoute('about', {
        name: 'b',
        path: 'detail1',
        component: detailOne,
        meta: {
          title: 'detail12'
        }
      })

      router.addRoute('about', {
        path: 'detail2',
        component: detailTwo,
        meta: {
          title: '详情'
        }
      })

      return to.fullPath
    }
  })
}